Skip to content

fix: ignore Enter during IME composition in remaining text inputs#6575

Open
greymoth-jp wants to merge 1 commit into
FlowiseAI:mainfrom
greymoth-jp:fix/ime-composition-enter-inputs
Open

fix: ignore Enter during IME composition in remaining text inputs#6575
greymoth-jp wants to merge 1 commit into
FlowiseAI:mainfrom
greymoth-jp:fix/ime-composition-enter-inputs

Conversation

@greymoth-jp

Copy link
Copy Markdown

What

ChatMessage and VectorStoreQuery already skip their Enter handler while an IME is composing:

const isIMEComposition = e.isComposing || e.keyCode === 229
if (e.key === 'Enter' && ... && !isIMEComposition) { ... }

A few other single-line text inputs handle Enter on keydown but don't have that check, so they act while the user is still composing.

Why

When typing with an IME (Japanese, Chinese, Korean, and macOS dead keys), the Enter that confirms a candidate fires a keydown with key === 'Enter' (and keyCode === 229 / isComposing === true) before compositionend. Without a guard, that first confirmation Enter is treated as a submit, so:

  • Canvas header: the flow name is saved and edit mode closes on the first IME confirmation, before the user has finished the name.
  • Save chatflow dialog: the dialog confirms on the confirmation key.
  • Tag dialog and Export-as-template dialog: a half-composed string gets added as a tag / usecase.

The result is that a CJK user cannot reliably type a multi-character word in these fields.

Change

Apply the same guard the repo already uses in ChatMessage and VectorStoreQuery to the inputs that were missing it:

  • views/canvas/CanvasHeader.jsx (flow name rename)
  • ui-component/dialog/SaveChatflowDialog.jsx (save name)
  • ui-component/dialog/TagDialog.jsx (add tag)
  • ui-component/dialog/ExportAsTemplateDialog.jsx (add usecase)

For a normal keystroke isComposing is false and keyCode is 13, so the guard is a no-op and existing behavior is unchanged. Escape handling is left as-is.

Testing

I didn't have an IME set up to reproduce this directly. I confirmed the changed files build and that the guard expression is identical to the one already shipping in ChatMessage / VectorStoreQuery. A manual check with a Japanese or Chinese IME in these four fields would be welcome to confirm.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces IME (Input Method Editor) composition checks across several dialogs and headers to prevent the 'Enter' key from prematurely triggering actions while a user is still composing text. The reviewer suggests also guarding the 'Escape' key handler in CanvasHeader with the same !isIMEComposition check to prevent closing the editing mode when a user cancels IME composition.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +487 to 490
if (e.key === 'Enter' && !isIMEComposition) {
submitFlowName()
} else if (e.key === 'Escape') {
setEditingFlowName(false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When typing with an IME, pressing the Escape key is often used to cancel or close the IME candidate list or composition window. If we do not guard the Escape key handler with !isIMEComposition, pressing Escape to cancel composition will bubble up and immediately close the editing mode, discarding the user's input.

We should apply the same !isIMEComposition guard to the Escape key check.

Suggested change
if (e.key === 'Enter' && !isIMEComposition) {
submitFlowName()
} else if (e.key === 'Escape') {
setEditingFlowName(false)
if (e.key === 'Enter' && !isIMEComposition) {
submitFlowName()
} else if (e.key === 'Escape' && !isIMEComposition) {
setEditingFlowName(false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant